package com.zxx.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/quick")
public class QuickController {

    @Value("${name}")
    private String name;

    @Value("${pp.name}")
    private String pname;

    @Value("${address[0]}")
    private String address;

    @Autowired
    private Environment env;

    @GetMapping("/index")
    public String index() {

        System.out.println(name);
        System.out.println(pname);
        System.out.println(address);

        System.out.println(env.getProperty("server.port"));
        System.out.println(env.getProperty("pp.name"));
        System.out.println(env.getProperty("address[0]"));

        return "hello world!";
    }
}
